<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>历史对话系统</title>
    <link rel="stylesheet" href="styles.css">
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标库 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <!-- jQueryUI CSS -->
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
</head>
<body>
    <div class="container-fluid main-container">
        <div class="row">
            <!-- 左侧面板 -->
            <div class="col-md-6 left-panel">
                <!-- 左上输入区域 -->
                <div class="card input-area">
                    <div class="card-header">
                        <h5>请输入历史事件</h5>
                    </div>
                    <div class="card-body">
                        <textarea id="inputText" class="form-control" rows="6"></textarea>
                        <button id="sendButton" class="btn btn-primary mt-3">
                            <i class="fas fa-paper-plane"></i> 发送
                        </button>
                    </div>
                </div>
                
                <!-- 左下历史事件列表 -->
                <div class="row history-lists">
                    <!-- 中国历史事件 -->
                    <div class="col-md-6">
                        <div class="card">
                            <div class="card-header">
                                <h5>中国历史重大事件</h5>
                            </div>
                            <div class="card-body">
                                <div class="btn-group mb-2">
                                    <button id="chinaExpandAll" class="btn btn-sm btn-outline-secondary">全部展开</button>
                                    <button id="chinaCollapseAll" class="btn btn-sm btn-outline-secondary">全部收起</button>
                                </div>
                                <div id="chinaTree" class="tree-container"></div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 世界历史事件 -->
                    <div class="col-md-6">
                        <div class="card">
                            <div class="card-header">
                                <h5>世界历史重大事件</h5>
                            </div>
                            <div class="card-body">
                                <div class="btn-group mb-2">
                                    <button id="worldExpandAll" class="btn btn-sm btn-outline-secondary">全部展开</button>
                                    <button id="worldCollapseAll" class="btn btn-sm btn-outline-secondary">全部收起</button>
                                </div>
                                <div id="worldTree" class="tree-container"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 右侧显示区域 -->
            <div class="col-md-6 right-panel">
                <div class="card display-area">
                    <div class="card-header">
                        <h5>历史信息</h5>
                    </div>
                    <div class="card-body">
                        <div id="displayText" class="display-text"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 加载提示 -->
    <div id="loadingOverlay" class="loading-overlay">
        <div class="spinner-border text-light" role="status">
            <span class="visually-hidden">加载中...</span>
        </div>
        <div class="mt-2 text-light">正在处理请求，请稍候...</div>
    </div>

    <!-- 错误提示模态框 -->
    <div class="modal fade" id="errorModal" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">错误</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body" id="errorModalBody">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <!-- jQuery -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- jQueryUI -->
    <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
    <!-- Bootstrap 5 JS Bundle -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <!-- jsTree 库 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.15/jstree.min.js"></script>
    <!-- 自定义脚本 -->
    <script src="script.js"></script>
</body>
</html>